package localizer.main;

import java.util.ArrayList;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import android.widget.Toast;

public class SimController extends BroadcastReceiver {
	Config config;
	@Override
	public void onReceive(Context context, Intent intent) {
		config = Config.getInstance(context.getApplicationContext());
		TelephonyManager tel = (TelephonyManager) context.getSystemService(context.TELEPHONY_SERVICE);
        String simId = tel.getSimSerialNumber();
        config = Config.getInstance(context.getApplicationContext());
        if(!config.hasSimId(context, simId)&&config.hasUser(context)&&config.isEnableCheckCheckSim(context)){
        	Intent dialogIntent = new Intent(context, SimRegisterActivity.class);
        	dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        	dialogIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        	dialogIntent.addFlags(Intent.FLAG_FROM_BACKGROUND);
        	context.startActivity(dialogIntent);
        }

	}

}
